package com.tech.connect.api;


import com.ksy.common.utils.CommonApiUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * Created by Ksy
 */

public class HttpUtils extends CommonApiUtils {
    public static Map<String, Object> getMap() {
        return new HashMap<>();
    }

    public interface ConnectApiServer {
        //String Base_url = "http://api.lc.test.cn-apps.com:8080/";


        @POST("v1/common/follow/create")
        Observable<BaseEntity<Map<String, String>>> follow(@Body Map<String, Object> map);

        @POST("v1/common/comment/add-like")
        Observable<BaseEntity<Integer>> praise(@Body Map<String, Object> map);

        @POST("sms/verification-code")
        Observable<BaseEntity<Map<String, String>>> sendCode(@Body Map<String, Object> map);

        @POST("register")
        Observable<BaseEntity<Map<String, String>>> register(@Body Map<String, Object> map);

        @POST("login")
        Observable<BaseEntity<Map<String, String>>> login(@Body Map<String, Object> map);


        @POST("v1/private/user/info")
        Observable<BaseEntity<UserInfo>> getUserInfo();

        @POST("/v1/talent/{resumeId}/detail")
        Observable<BaseEntity<Map<String, String>>> jianliDetail(@Path("resumeId") String resumeId);

        @POST("dictionary/dictionary/all")
        Observable<BaseEntity<List<Map<String, String>>>> allCat();

        @POST("v1/common/comment/create")
        Observable<BaseEntity<Object>> comment(@Body Map<String, Object> map);
    }

    public static Observable<BaseEntity<Object>> comment(Map<String, Object> map, final BaseEntityOb<Object> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).comment(map));
    }
  public static Observable<BaseEntity<Map<String, String>>> follow(Map<String, Object> map, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).follow(map));
    }

    public static Observable<BaseEntity<Integer>> praise(Map<String, Object> map, final BaseEntityOb<Integer> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).praise(map));
    }

    public static Observable<BaseEntity<List<Map<String, String>>>> allCat(final BaseEntityOb<List<Map<String, String>>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).allCat());
    }

    public static Observable<BaseEntity<Map<String, String>>> jianliDetail(String resumeId, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).jianliDetail(resumeId));
    }


    public static Observable<BaseEntity<Map<String, String>>> sendCode(Map<String, Object> map, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).sendCode(map));
    }

    public static Observable<BaseEntity<Map<String, String>>> register(Map<String, Object> map, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).register(map));
    }

    public static Observable<BaseEntity<Map<String, String>>> login(Map<String, Object> map, final BaseEntityOb<Map<String, String>> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).login(map));
    }

    public static Observable<BaseEntity<UserInfo>> getUserInfo(final BaseEntityOb<UserInfo> ob) {
        return ob.bindObed(ConnectApiManager.getApiServer(ConnectApiServer.class).getUserInfo());
    }


}
